<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

<title>class RDoc::Markup::PreProcess - rdoc: Ruby Standard Library Documentation</title>


<script src="../../js/navigation.js" defer></script>
<script src="../../js/search.js" defer></script>
<script src="../../js/search_index.js" defer></script>
<script src="../../js/searcher.js" defer></script>
<script src="../../js/darkfish.js" defer></script>

<script src="../../js/jquery-3.2.0.min.js"></script>

<script src="../../js/vue.min.js"></script>
<script src="../../js/js.cookie.min.js"></script>

<link href="../../css/fonts.css" rel="stylesheet">
<link id='rdoccss' href="../../css/rdoc.css" rel="stylesheet">
<link href="../../css/carbon17.css" rel="stylesheet">

<script type="text/javascript">
  var rdoc_rel_prefix = "../../";
  var index_rel_prefix = "../../";
  var darkModeCsseHref = "../../css/rdoc-dm.css"
  var defaultModeCssHref = "../../css/rdoc.css"
  // var cssDarkmode = Cookies.get('darkmode');
  
  if( Cookies.get("darkmode") == "true") {
	$('#rdoccss').attr("href", darkModeCsseHref);
}

//  https://cssdeck.com/blog/simple-jquery-stylesheet-switcher/

document.write('<style type="text/css">body{display:none}</style>');

</script>


</head>
<body id="top" role="document" class="class">
  <!-- this is class.html -->

  <div id='actionbar' >
    <div class='wrapper mdiv'>
      <ul class='grids g0'></ul>
    </div> 
    <!-- VERSION HEADER for 3.3.0.preview2 NOT FOUND -->
  </div> <!-- end action bar -->

  <div class='wrapper hdiv'>

    


    <nav id='vapp' role="navigation">
    <div id="project-navigation">
      <div id="home-section" role="region" title="Quick navigation" class="nav-section">
  <h2><a href="../../index.html" rel="home">Home</a></h2>

  <div id="table-of-contents-navigation"  >
    <a href="../../table_of_contents.html#pages">Pages</a>
    <a href="../../table_of_contents.html#classes">Classes</a>
    <a href="../../table_of_contents.html#methods">Methods</a>
  </div>
</div>

      <div id="search-section" role="search" class="project-section initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <div id="search-field-wrapper">
      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">
    </div>

    <ul id="search-results" aria-label="Search Results"
        aria-busy="false" aria-expanded="false"
        aria-atomic="false" class="initially-hidden"></ul>
  </form>
</div>

    </div>


    

    <button id='toggleThing' @click="toggleNav()" >Show/hide navigation</button>
    <div :class="isOpen ? 'block' : 'hidden' " id='toggleMe'>
      <div id="class-metadata">
        
        
<div id="parent-class-section" class="nav-section">
  <h3>Parent</h3>

  <p class="link"><a href="../../Object.html">Object</a>
</div>

        
        
        
<!-- Method Quickref -->
<div id="method-list-section" class="nav-section">
  <h3>Methods</h3>

  <ul class="link-list" role="directory">
    <li ><a href="#method-c-new">::new</a>
    <li ><a href="#method-c-post_process">::post_process</a>
    <li ><a href="#method-c-post_processors">::post_processors</a>
    <li ><a href="#method-c-register">::register</a>
    <li ><a href="#method-c-registered">::registered</a>
    <li ><a href="#method-c-reset">::reset</a>
    <li ><a href="#method-i-find_include_file">#find_include_file</a>
    <li ><a href="#method-i-handle">#handle</a>
    <li ><a href="#method-i-handle_directive">#handle_directive</a>
    <li ><a href="#method-i-include_file">#include_file</a>
  </ul>
</div>

      </div>
     </div>
    </nav>


    <div id='extraz'><div class='adzbox-index'  >
      
     </div>         
    </div>

    <main role="main" aria-labelledby="class-RDoc::Markup::PreProcess">
    <h1 id="class-RDoc::Markup::PreProcess" class="class">
      class RDoc::Markup::PreProcess
    </h1>

    <section class="description">
    
<p>Handle common directives that can occur in a block of text:</p>

<pre>:include: filename</pre>

<p>Directives can be escaped by preceding them with a backslash.</p>

<p><a href="../../RDoc.html"><code>RDoc</code></a> plugin authors can register additional directives to be handled by using <a href="PreProcess.html#method-c-register"><code>RDoc::Markup::PreProcess::register</code></a>.</p>

<p>Any directive that is not built-in to <a href="../../RDoc.html"><code>RDoc</code></a> (including those registered via plugins) will be stored in the metadata hash on the CodeObject the comment is attached to.  See <a href="../Markup.html#class-RDoc::Markup-label-Directives">Directives at <code>RDoc::Markup</code></a> for the list of built-in directives.</p>

    </section>

      <section id="5Buntitled-5D" class="documentation-section">



        <section class="attribute-method-details" class="method-section">
        <header>
        <h3>Attributes</h3>
        </header>

          <div id="attribute-i-options" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">options</span><span
                class="attribute-access-type">[RW]</span>
            </div>

            <div class="method-description">
              <p>An <a href="../Options.html"><code>RDoc::Options</code></a> instance that will be filled in with overrides from directives</p>
              </div>
            </div>
            </section>


                <section id="public-class-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Class Methods</h3>
                </header>

                  <div id="method-c-new" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">new</span><span
                                class="method-args">(input_file_name, include_path)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Creates a new pre-processor for <code>input_file_name</code> that will look for included files in <code>include_path</code></p>

                              <div class="method-source-code" id="new-source">
            <pre><span class="ruby-comment"># File rdoc/markup/pre_process.rb, line 78</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>(<span class="ruby-identifier">input_file_name</span>, <span class="ruby-identifier">include_path</span>)
  <span class="ruby-ivar">@input_file_name</span> = <span class="ruby-identifier">input_file_name</span>
  <span class="ruby-ivar">@include_path</span> = <span class="ruby-identifier">include_path</span>
  <span class="ruby-ivar">@options</span> = <span class="ruby-keyword">nil</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-post_process" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">post_process</span><span
                                class="method-args">(&amp;block)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Adds a post-process handler for directives.  The handler will be called with the result <a href="../Comment.html"><code>RDoc::Comment</code></a> (or text String) and the code object for the comment (if any).</p>

                              <div class="method-source-code" id="post_process-source">
            <pre><span class="ruby-comment"># File rdoc/markup/pre_process.rb, line 30</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">post_process</span> <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>
  <span class="ruby-ivar">@post_processors</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">block</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-post_processors" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">post_processors</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Registered post-processors</p>

                              <div class="method-source-code" id="post_processors-source">
            <pre><span class="ruby-comment"># File rdoc/markup/pre_process.rb, line 37</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">post_processors</span>
  <span class="ruby-ivar">@post_processors</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-register" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">register</span><span
                                class="method-args">(directive, &amp;block)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Registers <code>directive</code> as one handled by <a href="../../RDoc.html"><code>RDoc</code></a>.  If a block is given the directive will be replaced by the result of the block, otherwise the directive will be removed from the processed text.</p>

<p>The block will be called with the directive name and the directive parameter:</p>

<pre class="ruby"><span class="ruby-constant">RDoc</span><span class="ruby-operator">::</span><span class="ruby-constant">Markup</span><span class="ruby-operator">::</span><span class="ruby-constant">PreProcess</span>.<span class="ruby-identifier">register</span> <span class="ruby-string">&#39;my-directive&#39;</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">directive</span>, <span class="ruby-identifier">param</span><span class="ruby-operator">|</span>
  <span class="ruby-comment"># replace text, etc.</span>
<span class="ruby-keyword">end</span>
</pre>

                              <div class="method-source-code" id="register-source">
            <pre><span class="ruby-comment"># File rdoc/markup/pre_process.rb, line 53</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">register</span> <span class="ruby-identifier">directive</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>
  <span class="ruby-ivar">@registered</span>[<span class="ruby-identifier">directive</span>] = <span class="ruby-identifier">block</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-registered" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">registered</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Registered directives</p>

                              <div class="method-source-code" id="registered-source">
            <pre><span class="ruby-comment"># File rdoc/markup/pre_process.rb, line 60</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">registered</span>
  <span class="ruby-ivar">@registered</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-reset" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">reset</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Clears all registered directives and post-processors</p>

                              <div class="method-source-code" id="reset-source">
            <pre><span class="ruby-comment"># File rdoc/markup/pre_process.rb, line 67</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">reset</span>
  <span class="ruby-ivar">@post_processors</span> = []
  <span class="ruby-ivar">@registered</span> = {}
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

                <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Instance Methods</h3>
                </header>

                  <div id="method-i-find_include_file" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">find_include_file</span><span
                                class="method-args">(name)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Look for the given file in the directory containing the current file, and then in each of the directories specified in the RDOC_INCLUDE path</p>

                              <div class="method-source-code" id="find_include_file-source">
            <pre><span class="ruby-comment"># File rdoc/markup/pre_process.rb, line 288</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">find_include_file</span>(<span class="ruby-identifier">name</span>)
  <span class="ruby-identifier">to_search</span> = [<span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-ivar">@input_file_name</span>)].<span class="ruby-identifier">concat</span> <span class="ruby-ivar">@include_path</span>
  <span class="ruby-identifier">to_search</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">dir</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">full_name</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">dir</span>, <span class="ruby-identifier">name</span>)
    <span class="ruby-identifier">stat</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">stat</span>(<span class="ruby-identifier">full_name</span>) <span class="ruby-keyword">rescue</span> <span class="ruby-keyword">next</span>
    <span class="ruby-keyword">return</span> <span class="ruby-identifier">full_name</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">stat</span>.<span class="ruby-identifier">readable?</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">nil</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-handle" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">handle</span><span
                                class="method-args">(text, code_object = nil, &amp;block)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Look for directives in the given <code>text</code>.</p>

<p>Options that we don’t handle are yielded.  If the block returns false the directive is restored to the text.  If the block returns nil or no block was given the directive is handled according to the registered directives. If a String was returned the directive is replaced with the string.</p>

<p>If no matching directive was registered the directive is restored to the text.</p>

<p>If <code>code_object</code> is given and the directive is unknown then the directive’s parameter is set as metadata on the <code>code_object</code>.  See <a href="../CodeObject.html#attribute-i-metadata"><code>RDoc::CodeObject#metadata</code></a> for details.</p>

                              <div class="method-source-code" id="handle-source">
            <pre><span class="ruby-comment"># File rdoc/markup/pre_process.rb, line 99</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">handle</span> <span class="ruby-identifier">text</span>, <span class="ruby-identifier">code_object</span> = <span class="ruby-keyword">nil</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>
  <span class="ruby-keyword">if</span> <span class="ruby-constant">RDoc</span><span class="ruby-operator">::</span><span class="ruby-constant">Comment</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">text</span> <span class="ruby-keyword">then</span>
    <span class="ruby-identifier">comment</span> = <span class="ruby-identifier">text</span>
    <span class="ruby-identifier">text</span> = <span class="ruby-identifier">text</span>.<span class="ruby-identifier">text</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-comment"># regexp helper (square brackets for optional)</span>
  <span class="ruby-comment"># $1      $2  $3        $4      $5</span>
  <span class="ruby-comment"># [prefix][\]:directive:[spaces][param]newline</span>
  <span class="ruby-identifier">text</span> = <span class="ruby-identifier">text</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp">/^([ \t]*(?:#|\/?\*)?[ \t]*)(\\?):(\w+):([ \t]*)(.+)?(\r?\n|$)/</span>) <span class="ruby-keyword">do</span>
    <span class="ruby-comment"># skip something like &#39;:toto::&#39;</span>
    <span class="ruby-keyword">next</span> <span class="ruby-node">$&amp;</span> <span class="ruby-keyword">if</span> <span class="ruby-node">$4</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-keyword">and</span> <span class="ruby-node">$5</span> <span class="ruby-keyword">and</span> <span class="ruby-node">$5</span>[<span class="ruby-value">0</span>, <span class="ruby-value">1</span>] <span class="ruby-operator">==</span> <span class="ruby-string">&#39;:&#39;</span>

    <span class="ruby-comment"># skip if escaped</span>
    <span class="ruby-keyword">next</span> <span class="ruby-string">&quot;#$1:#$3:#$4#$5\n&quot;</span> <span class="ruby-keyword">unless</span> <span class="ruby-node">$2</span>.<span class="ruby-identifier">empty?</span>

    <span class="ruby-comment"># This is not in handle_directive because I didn&#39;t want to pass another</span>
    <span class="ruby-comment"># argument into it</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">comment</span> <span class="ruby-keyword">and</span> <span class="ruby-node">$3</span> <span class="ruby-operator">==</span> <span class="ruby-string">&#39;markup&#39;</span> <span class="ruby-keyword">then</span>
      <span class="ruby-keyword">next</span> <span class="ruby-node">&quot;#{$1.strip}\n&quot;</span> <span class="ruby-keyword">unless</span> <span class="ruby-node">$5</span>
      <span class="ruby-identifier">comment</span>.<span class="ruby-identifier">format</span> = <span class="ruby-node">$5</span>.<span class="ruby-identifier">downcase</span>
      <span class="ruby-keyword">next</span> <span class="ruby-node">&quot;#{$1.strip}\n&quot;</span>
    <span class="ruby-keyword">end</span>

    <span class="ruby-identifier">handle_directive</span> <span class="ruby-node">$1</span>, <span class="ruby-node">$3</span>, <span class="ruby-node">$5</span>, <span class="ruby-identifier">code_object</span>, <span class="ruby-identifier">text</span>.<span class="ruby-identifier">encoding</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">comment</span> <span class="ruby-keyword">then</span>
    <span class="ruby-identifier">comment</span>.<span class="ruby-identifier">text</span> = <span class="ruby-identifier">text</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">comment</span> = <span class="ruby-identifier">text</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">post_processors</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">handler</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">handler</span>.<span class="ruby-identifier">call</span> <span class="ruby-identifier">comment</span>, <span class="ruby-identifier">code_object</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">text</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-handle_directive" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">handle_directive</span><span
                                class="method-args">(prefix, directive, param, code_object = nil, encoding = nil) { |directive, param| ... }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Performs the actions described by <code>directive</code> and its parameter <code>param</code>.</p>

<p><code>code_object</code> is used for directives that operate on a class or module. <code>prefix</code> is used to ensure the replacement for handled directives is correct.  <code>encoding</code> is used for the <code>include</code> directive.</p>

<p>For a list of directives in <a href="../../RDoc.html"><code>RDoc</code></a> see <a href="../Markup.html"><code>RDoc::Markup</code></a>.</p>

                              <div class="method-source-code" id="handle_directive-source">
            <pre><span class="ruby-comment"># File rdoc/markup/pre_process.rb, line 150</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">handle_directive</span> <span class="ruby-identifier">prefix</span>, <span class="ruby-identifier">directive</span>, <span class="ruby-identifier">param</span>, <span class="ruby-identifier">code_object</span> = <span class="ruby-keyword">nil</span>,
                     <span class="ruby-identifier">encoding</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-identifier">blankline</span> = <span class="ruby-node">&quot;#{prefix.strip}\n&quot;</span>
  <span class="ruby-identifier">directive</span> = <span class="ruby-identifier">directive</span>.<span class="ruby-identifier">downcase</span>

  <span class="ruby-keyword">case</span> <span class="ruby-identifier">directive</span>
  <span class="ruby-keyword">when</span> <span class="ruby-string">&#39;arg&#39;</span>, <span class="ruby-string">&#39;args&#39;</span> <span class="ruby-keyword">then</span>
    <span class="ruby-keyword">return</span> <span class="ruby-node">&quot;#{prefix}:#{directive}: #{param}\n&quot;</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">code_object</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">code_object</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">RDoc</span><span class="ruby-operator">::</span><span class="ruby-constant">AnyMethod</span>)

    <span class="ruby-identifier">code_object</span>.<span class="ruby-identifier">params</span> = <span class="ruby-identifier">param</span>

    <span class="ruby-identifier">blankline</span>
  <span class="ruby-keyword">when</span> <span class="ruby-string">&#39;category&#39;</span> <span class="ruby-keyword">then</span>
    <span class="ruby-keyword">if</span> <span class="ruby-constant">RDoc</span><span class="ruby-operator">::</span><span class="ruby-constant">Context</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">code_object</span> <span class="ruby-keyword">then</span>
      <span class="ruby-identifier">section</span> = <span class="ruby-identifier">code_object</span>.<span class="ruby-identifier">add_section</span> <span class="ruby-identifier">param</span>
      <span class="ruby-identifier">code_object</span>.<span class="ruby-identifier">temporary_section</span> = <span class="ruby-identifier">section</span>
    <span class="ruby-keyword">elsif</span> <span class="ruby-constant">RDoc</span><span class="ruby-operator">::</span><span class="ruby-constant">AnyMethod</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">code_object</span> <span class="ruby-keyword">then</span>
      <span class="ruby-identifier">code_object</span>.<span class="ruby-identifier">section_title</span> = <span class="ruby-identifier">param</span>
    <span class="ruby-keyword">end</span>

    <span class="ruby-identifier">blankline</span> <span class="ruby-comment"># ignore category if we&#39;re not on an RDoc::Context</span>
  <span class="ruby-keyword">when</span> <span class="ruby-string">&#39;doc&#39;</span> <span class="ruby-keyword">then</span>
    <span class="ruby-keyword">return</span> <span class="ruby-identifier">blankline</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">code_object</span>
    <span class="ruby-identifier">code_object</span>.<span class="ruby-identifier">document_self</span> = <span class="ruby-keyword">true</span>
    <span class="ruby-identifier">code_object</span>.<span class="ruby-identifier">force_documentation</span> = <span class="ruby-keyword">true</span>

    <span class="ruby-identifier">blankline</span>
  <span class="ruby-keyword">when</span> <span class="ruby-string">&#39;enddoc&#39;</span> <span class="ruby-keyword">then</span>
    <span class="ruby-keyword">return</span> <span class="ruby-identifier">blankline</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">code_object</span>
    <span class="ruby-identifier">code_object</span>.<span class="ruby-identifier">done_documenting</span> = <span class="ruby-keyword">true</span>

    <span class="ruby-identifier">blankline</span>
  <span class="ruby-keyword">when</span> <span class="ruby-string">&#39;include&#39;</span> <span class="ruby-keyword">then</span>
    <span class="ruby-identifier">filename</span> = <span class="ruby-identifier">param</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">&#39; &#39;</span>, <span class="ruby-value">2</span>).<span class="ruby-identifier">first</span>
    <span class="ruby-identifier">include_file</span> <span class="ruby-identifier">filename</span>, <span class="ruby-identifier">prefix</span>, <span class="ruby-identifier">encoding</span>
  <span class="ruby-keyword">when</span> <span class="ruby-string">&#39;main&#39;</span> <span class="ruby-keyword">then</span>
    <span class="ruby-ivar">@options</span>.<span class="ruby-identifier">main_page</span> = <span class="ruby-identifier">param</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@options</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-value">:main_page</span>

    <span class="ruby-identifier">blankline</span>
  <span class="ruby-keyword">when</span> <span class="ruby-string">&#39;nodoc&#39;</span> <span class="ruby-keyword">then</span>
    <span class="ruby-keyword">return</span> <span class="ruby-identifier">blankline</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">code_object</span>
    <span class="ruby-identifier">code_object</span>.<span class="ruby-identifier">document_self</span> = <span class="ruby-keyword">nil</span> <span class="ruby-comment"># notify nodoc</span>
    <span class="ruby-identifier">code_object</span>.<span class="ruby-identifier">document_children</span> = <span class="ruby-identifier">param</span> <span class="ruby-operator">!~</span> <span class="ruby-regexp">/all/i</span>

    <span class="ruby-identifier">blankline</span>
  <span class="ruby-keyword">when</span> <span class="ruby-string">&#39;notnew&#39;</span>, <span class="ruby-string">&#39;not_new&#39;</span>, <span class="ruby-string">&#39;not-new&#39;</span> <span class="ruby-keyword">then</span>
    <span class="ruby-keyword">return</span> <span class="ruby-identifier">blankline</span> <span class="ruby-keyword">unless</span> <span class="ruby-constant">RDoc</span><span class="ruby-operator">::</span><span class="ruby-constant">AnyMethod</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">code_object</span>

    <span class="ruby-identifier">code_object</span>.<span class="ruby-identifier">dont_rename_initialize</span> = <span class="ruby-keyword">true</span>

    <span class="ruby-identifier">blankline</span>
  <span class="ruby-keyword">when</span> <span class="ruby-string">&#39;startdoc&#39;</span> <span class="ruby-keyword">then</span>
    <span class="ruby-keyword">return</span> <span class="ruby-identifier">blankline</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">code_object</span>

    <span class="ruby-identifier">code_object</span>.<span class="ruby-identifier">start_doc</span>
    <span class="ruby-identifier">code_object</span>.<span class="ruby-identifier">force_documentation</span> = <span class="ruby-keyword">true</span>

    <span class="ruby-identifier">blankline</span>
  <span class="ruby-keyword">when</span> <span class="ruby-string">&#39;stopdoc&#39;</span> <span class="ruby-keyword">then</span>
    <span class="ruby-keyword">return</span> <span class="ruby-identifier">blankline</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">code_object</span>

    <span class="ruby-identifier">code_object</span>.<span class="ruby-identifier">stop_doc</span>

    <span class="ruby-identifier">blankline</span>
  <span class="ruby-keyword">when</span> <span class="ruby-string">&#39;title&#39;</span> <span class="ruby-keyword">then</span>
    <span class="ruby-ivar">@options</span>.<span class="ruby-identifier">default_title</span> = <span class="ruby-identifier">param</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@options</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-value">:default_title=</span>

    <span class="ruby-identifier">blankline</span>
  <span class="ruby-keyword">when</span> <span class="ruby-string">&#39;yield&#39;</span>, <span class="ruby-string">&#39;yields&#39;</span> <span class="ruby-keyword">then</span>
    <span class="ruby-keyword">return</span> <span class="ruby-identifier">blankline</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">code_object</span>
    <span class="ruby-comment"># remove parameter &amp;block</span>
    <span class="ruby-identifier">code_object</span>.<span class="ruby-identifier">params</span> = <span class="ruby-identifier">code_object</span>.<span class="ruby-identifier">params</span>.<span class="ruby-identifier">sub</span>(<span class="ruby-regexp">/,?\s*&amp;\w+/</span>, <span class="ruby-string">&#39;&#39;</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">code_object</span>.<span class="ruby-identifier">params</span>

    <span class="ruby-identifier">code_object</span>.<span class="ruby-identifier">block_params</span> = <span class="ruby-identifier">param</span>

    <span class="ruby-identifier">blankline</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">result</span> = <span class="ruby-keyword">yield</span> <span class="ruby-identifier">directive</span>, <span class="ruby-identifier">param</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">block_given?</span>

    <span class="ruby-keyword">case</span> <span class="ruby-identifier">result</span>
    <span class="ruby-keyword">when</span> <span class="ruby-keyword">nil</span> <span class="ruby-keyword">then</span>
      <span class="ruby-identifier">code_object</span>.<span class="ruby-identifier">metadata</span>[<span class="ruby-identifier">directive</span>] = <span class="ruby-identifier">param</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">code_object</span>

      <span class="ruby-keyword">if</span> <span class="ruby-constant">RDoc</span><span class="ruby-operator">::</span><span class="ruby-constant">Markup</span><span class="ruby-operator">::</span><span class="ruby-constant">PreProcess</span>.<span class="ruby-identifier">registered</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">directive</span> <span class="ruby-keyword">then</span>
        <span class="ruby-identifier">handler</span> = <span class="ruby-constant">RDoc</span><span class="ruby-operator">::</span><span class="ruby-constant">Markup</span><span class="ruby-operator">::</span><span class="ruby-constant">PreProcess</span>.<span class="ruby-identifier">registered</span>[<span class="ruby-identifier">directive</span>]
        <span class="ruby-identifier">result</span> = <span class="ruby-identifier">handler</span>.<span class="ruby-identifier">call</span> <span class="ruby-identifier">directive</span>, <span class="ruby-identifier">param</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">handler</span>
      <span class="ruby-keyword">else</span>
        <span class="ruby-identifier">result</span> = <span class="ruby-node">&quot;#{prefix}:#{directive}: #{param}\n&quot;</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">when</span> <span class="ruby-keyword">false</span> <span class="ruby-keyword">then</span>
      <span class="ruby-identifier">result</span> = <span class="ruby-node">&quot;#{prefix}:#{directive}: #{param}\n&quot;</span>
    <span class="ruby-keyword">end</span>

    <span class="ruby-identifier">result</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-include_file" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">include_file</span><span
                                class="method-args">(name, indent, encoding)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Handles the <code>:include: <em>filename</em></code> directive.</p>

<p>If the first line of the included file starts with ‘#’, and contains an encoding information in the form ‘coding:’ or ‘coding=’, it is removed.</p>

<p>If all lines in the included file start with a ‘#’, this leading ‘#’ is removed before inclusion. The included content is indented like the <code>:include:</code> directive.</p>

                              <div class="method-source-code" id="include_file-source">
            <pre><span class="ruby-comment"># File rdoc/markup/pre_process.rb, line 262</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">include_file</span> <span class="ruby-identifier">name</span>, <span class="ruby-identifier">indent</span>, <span class="ruby-identifier">encoding</span>
  <span class="ruby-identifier">full_name</span> = <span class="ruby-identifier">find_include_file</span> <span class="ruby-identifier">name</span>

  <span class="ruby-keyword">unless</span> <span class="ruby-identifier">full_name</span> <span class="ruby-keyword">then</span>
    <span class="ruby-identifier">warn</span> <span class="ruby-node">&quot;Couldn&#39;t find file to include &#39;#{name}&#39; from #{@input_file_name}&quot;</span>
    <span class="ruby-keyword">return</span> <span class="ruby-string">&#39;&#39;</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">content</span> = <span class="ruby-constant">RDoc</span><span class="ruby-operator">::</span><span class="ruby-constant">Encoding</span>.<span class="ruby-identifier">read_file</span> <span class="ruby-identifier">full_name</span>, <span class="ruby-identifier">encoding</span>, <span class="ruby-keyword">true</span>
  <span class="ruby-identifier">content</span> = <span class="ruby-constant">RDoc</span><span class="ruby-operator">::</span><span class="ruby-constant">Encoding</span>.<span class="ruby-identifier">remove_magic_comment</span> <span class="ruby-identifier">content</span>

  <span class="ruby-comment"># strip magic comment</span>
  <span class="ruby-identifier">content</span> = <span class="ruby-identifier">content</span>.<span class="ruby-identifier">sub</span>(<span class="ruby-regexp">/\A# .*coding[=:].*$/</span>, <span class="ruby-string">&#39;&#39;</span>).<span class="ruby-identifier">lstrip</span>

  <span class="ruby-comment"># strip leading &#39;#&#39;s, but only if all lines start with them</span>
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">content</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/^[^#]/</span> <span class="ruby-keyword">then</span>
    <span class="ruby-identifier">content</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp">/^/</span>, <span class="ruby-identifier">indent</span>)
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">content</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp">/^#?/</span>, <span class="ruby-identifier">indent</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

              </section>
              </main>



            </div>  <!--  class='wrapper hdiv' -->


<footer id="validator-badges" role="contentinfo">
<p><a href="https://validator.w3.org/check/referer">Validate</a></p>
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.4.0.</p>
<p>Based on <a href="https://github.com/ged/darkfish/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.</p>

  
    <p><p><a href="https://ruby-doc.org">Ruby-doc.org</a> is provided by <a href="https://jamesbritt.com">James Britt</a> and <a href="https://neurogami.com">Neurogami</a>.</p><p><a href="https://jamesbritt.bandcamp.com/">Maximum R+D</a>.  </p>
</p>
  
  </footer>

<script type="text/javascript">


  let ads  = $("#carbonads-container").children().detach();


  function swapMode() {
    var cookieName = 'darkmode';
    var cssDarkmode = Cookies.get(cookieName);
    console.log("***** swapMode! " + cssDarkmode + " *****");


    if (cssDarkmode == "true") {
      console.log("We have dark mode, set the css to light ...");
      $('#rdoccss').attr("href", defaultModeCssHref);
      $('#cssSelect').text("Dark mode");
      cssDarkmode = "false";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    } else {
      console.log("We not have dark mode, set the css to dark ...");
      $('#rdoccss').attr("href", darkModeCsseHref);
      $('#cssSelect').text("Light mode");
      cssDarkmode = "true";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    }

    console.log("  --------------- ");
  }


const vueCssApp = new Vue({
el: '#menubar',
data: {
isDark: false
},
methods: {
toggleClass: function(event){
this.isDark = !this.isDark;
}
}
})

const vueApp = new Vue({
el: '#vapp',
data: { 
isOpen: true
},

mounted() {
this.handleResize();
this.manage_mob_classes();
window.addEventListener('resize', this.handleResize)
//this.isOpen !=  (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},
destroyed() {
window.removeEventListener('resize', this.handleResize)
},
created() {
//manage_mob_classes();
},

methods : {
isMobile() {
  return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},

  handleResize() {
    if (!this.isMobile()) {
      this.isOpen = window.innerWidth > 800;
    }
  },

  manage_mob_classes() {
    if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
      $("nav").addClass("mob_nav");
      $("main").addClass("mob_main");
      $("#extraz").addClass("mob_extraz");
      $("#carbonads-container").addClass("mob_carbonads-container");
      this.isOpen  = false;
    } else {
      $("nav").removeClass("mob_nav") 
        $("main").removeClass("mob_main");
      $("#extraz").removeClass("mob_extraz");
      $("#carbonads-container").removeClass("mob_carbonads-container");
      this.isOpen  = true;
    }
  },

  toggleNav() {
    this.isOpen =! this.isOpen ;
    // alert("Toggle nav!");
    console.log("toggleNav() click: " + this.isOpen );
  }
}
})

$("#carbonads-container").append(ads);


$(function() {

    var darkmode = Cookies.get("darkmode");
    console.log("Document ready: " + darkmode);

    if ( darkmode  == "true" ) {
      $('#cssSelect').text("Light mode");
    } else {
      $('#cssSelect').text("Dark mode");
     }

    $('body').css('display','block');
    });

</script>

    
  </body> 
</html>

